/**
 * @file abscombination.cpp
 * @brief AbsCombination class methods implementation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 *
 * @author VestniK (Sergey N.Vidyuk)
 * @date 11 Oct 2008
 */
#include "abscombination.h"

using namespace mjn;

/**
 * Adding pointer to tile to tiles list. This container contains pointers
 * to tiles not copies of tiles. If tiles list contains CombinationSize of
 * tiles than tile will not be added and this function return false. If
 * tile was sucessfully added this function return true.
 */
bool AbsCombination::addTile(Tile t) {
   if ( tiles.count() < CombinationSize ) {
      tiles.append(t);
      return true;
   }
   return false;
}

unsigned AbsCombination::score(WindType roundWind,WindType playerWind) const {
   if ( ! this->isValid() ) {
      return 0;
   }
   return calculateScore(roundWind,playerWind);
}

unsigned AbsCombination::multiplyFactor(WindType roundWind,WindType playerWind) const {
   if ( ! this->isValid() ) {
      return 1;
   }
   return calculateMultiplyFactor(roundWind,playerWind);
}
